package com.ybxx.base.model;

import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import com.ybxx.core.model.BaseModel;

@Entity
@Table(name="tbl_base_hydropower")
public class Hydropower extends BaseModel {
	@Id
	private String hcode;
	@ManyToOne(targetEntity=Community.class,fetch=FetchType.LAZY)
	@JoinColumn(name="cid",referencedColumnName="cid") 
	private Community community;
	private String content;
	
	@OneToMany(targetEntity=HydropowerItem.class,cascade={CascadeType.ALL},mappedBy="hydropower",fetch = FetchType.LAZY)
	private Set<HydropowerItem> hydropowerItems=new HashSet<HydropowerItem>();
	public String getHcode() {
		return hcode;
	}
	public void setHcode(String hcode) {
		this.hcode = hcode;
	}
	public Community getCommunity() {
		return community;
	}
	public void setCommunity(Community community) {
		this.community = community;
	}
	public String getContent() {
		return content;
	}
	public void setContent(String content) {
		this.content = content;
	}
	public Set<HydropowerItem> getHydropowerItems() {
		return hydropowerItems;
	}
	public void setHydropowerItems(Set<HydropowerItem> hydropowerItems) {
		this.hydropowerItems = hydropowerItems;
	}
	
	
}
